import request from '@/utils/request';
// 查询商户列表
export async function queryShopList(page = 1) {
  return request(`/lgjserve/admin/shops?page=${page}`, {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}
export async function initShop(params) {
  return request('/lgjserve/admin/shops/add', {
    method: 'post',
    data: {
      ...params,
    },
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}

export async function updateShop(params) {
  return request('/lgjserve/admin/updateshop', {
    headers: {
      Authorization: sessionStorage.token,
    },
    method: 'post',
    data: {
      ...params,
    },
  });
}

export async function changeShopStatus(params) {
  return request(`/lgjserve/admin/changeshopstatus`, {
    headers: {
      Authorization: sessionStorage.token,
    },
    method: 'post',
    data: {
      ...params,
    },
  });
}
export async function queryShopDetail(id) {
  return request(`/lgjserve/admin/shopdetail/${id}`, {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}
export async function uploadPhoto(params) {
  return request(`/lgjserve/singleupload`, {
    method: 'post',
    headers: {
      Authorization: sessionStorage.token,
    },
    processData: false,
    data: params,
  });
}

// 查询分类列表
export async function queryShopSortList(params) {
  return request(`/lgjserve/shopsorts?page=${params.currentPage}`, {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}
//创建分类
export async function createShopSort(params) {
  return request(`/lgjserve/shopsorts/store`, {
    headers: {
      Authorization: sessionStorage.token,
    },
    method: 'post',
    data: {
      ...params,
    },
  });
}
//获取分类详情
export async function queryShopSortDetail(id) {
  return request(`/lgjserve/shopsorts/sortdetail/${id}`, {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}
//获取可用分类
export async function queryAllShopSortList() {
  return request('/lgjserve/shopsorts/sortlist', {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}

export async function updateShopSort(params) {
  return request('/lgjserve/shopsorts/update', {
    headers: {
      Authorization: sessionStorage.token,
    },
    method: 'post',
    data: {
      ...params,
    },
  });
}

export async function delShopSort(id) {
  return request(`/lgjserve/shopsorts/delsort/${id}`, {
    headers: {
      Authorization: sessionStorage.token,
    },
  });
}

export async function updateAllShop(params) {
  return request(`/lgjserve/shop/updateall`, {
    headers: {
      Authorization: sessionStorage.token,
    },
    method: 'post',
    data: {
      ...params,
    },
  });
}
